package com.zj.easywebview;

import android.app.Activity;
import android.content.Context;
import android.webkit.WebView;

import org.json.JSONObject;


/**
 * @author zhengjun
 * @desc android原生与h5交互方法添加
 * @created at 2018/8/13 14:33
 */
public class NativeJsImpl {

    /**
     * @desc js调用跳转到对应的页面
     * 用法参考assets目录下的index.html
     * @author zhengjun
     * @created at 2018/7/26 10:22
     */
    @Deprecated
    public static void openActivity(Context context, WebView webView, String data, BridgeCallback callback) {
        try {
            JSONObject jo = new JSONObject(data);
            JsMethosManager.INSTANCE.openActivity(context, jo);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * @desc 关闭页面
     * @author zhengjun
     * @created at 2019/1/17 11:51
     */
    @Deprecated
    public static void finishPage(Context context, WebView webView, String data, BridgeCallback callback) {
        try {
            Activity activity = (Activity) context;
            activity.finish();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
